/*
 * @Date: 2023-06-06 17:37:56
 * @LastEditors: Chuying
 * @LastEditTime: 2023-07-05 15:45:46
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import './data.dart';

class Square extends StatefulWidget {
  const Square({Key? key}) : super(key: key);

  @override
  _SquareState createState() => _SquareState();
}

class _SquareState extends State<Square> {
  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: const EdgeInsets.all(14),
      children: [
        ...listData.map((item) => Card(
            elevation: 2,
            shadowColor: const Color(0x8FE8E8E8),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(8.0),
            ),
            margin: const EdgeInsets.only(bottom: 14),
            child: Padding(
              padding: const EdgeInsets.only(bottom: 20),
              child: Column(children: [
                ListTile(
                  title: Row(
                    children: [
                      Image.asset(
                        'assets/images/ring.png',
                        width: 18.w,
                        height: 18.w,
                      ),
                      Text(
                        '${item['title']}',
                        style: TextStyle(
                            fontSize: 18.sp,
                            fontWeight: FontWeight.w600,
                            color: const Color(0xFF222222)),
                      ),
                    ],
                  ),
                  subtitle: Container(
                    margin: const EdgeInsets.only(left: 20),
                    child: Text(
                      '23W人参与',
                      style: TextStyle(
                          fontSize: 12.sp, color: const Color(0xFF999999)),
                    ),
                  ),
                  trailing: TextButton(
                    onPressed: () {
                      Navigator.pushNamed(context, '/circle',
                          arguments: {"id": 1});
                    },
                    style: ButtonStyle(
                      backgroundColor: MaterialStateProperty.all(
                          const Color(0xFFF3F3F3)), // 设置背景色
                      padding: MaterialStateProperty.all<EdgeInsets>(
                          const EdgeInsets.fromLTRB(12, 5, 12, 5)), // 设置内边距
                      shape: MaterialStateProperty.all<RoundedRectangleBorder>(
                          RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(25.0),
                        // side: BorderSide.none, // 设置为空边框
                      )),
                    ),
                    child: const Text(
                      "去看看",
                      style: TextStyle(color: Color(0xFF333333)),
                    ),
                  ),
                ),
                Wrap(
                    spacing: 3.w, //横向间距
                    runSpacing: 3.w, //竖向间距
                    children: [
                      ...item['images'].map((img) => Container(
                            clipBehavior: Clip.hardEdge,
                            decoration: const BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(4))),
                            child: Image.network(
                              img,
                              width: 77.w,
                              height: 77.w,
                            ),
                          )),
                    ]),
              ]),
            )))
      ],
    );
  }
}
